const mongoose = require('mongoose');

const { Schema, model } = mongoose;

const topicSchema = new Schema({
  __v: { type: Number, select: false },
  name: { type: String, required: true },
  avatar_url: { type: String },
  introduction: { type: String, select: false, default: '' },
  createTime: {
    type: Date,
    select: false,
    default: Date.now
  },
  updateTime: {
    type: Date,
    select: false,
    default: Date.now
  }
}, {
  //timestamps: true
  timestamps: { createdAt: 'createTime', updatedAt: 'updateTime' }
});

module.exports = model('Topic', topicSchema);